package com.hzz.code;

/**
 * @author ：hzz
 * @description：TODO
 * @date ：2021/6/28 10:43
 */

public enum CommonResultCode implements ResultCode {
    SUCCESS("0", "成功"),
    UnknownException("999", "未知异常"),
    SystemException("500", "系统异常"),
    BusinessException("502", "业务错误"),
    RemoteCallException("555", "远程调用错误"),
    OrderCodeException("503", "岗亭指令执行错误"),
    InfoException("04", "提示级错误"),
    DBException("777", "数据库操作异常"),
    AuthenticationFailure("401", "用户异常!"),
    AuthenticationExpiredFailure("10401", "AccessToken已过期"),
    SC_FORBIDDEN("403", "无权限"),
    ParamException("410", "参数验证错误"),
    SystemMaintainException("111", "系统正在维护");

    public final String code;
    public final String msg;

    private CommonResultCode(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static CommonResultCode getByCode(String code) {
        CommonResultCode[] var1 = values();
        int var2 = var1.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            CommonResultCode ec = var1[var3];
            if (ec.getCode().equals(code)) {
                return ec;
            }
        }

        return null;
    }

    public String getCode() {
        return this.code;
    }

    public String getMsg() {
        return this.msg;
    }
}
